<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
  <script src="../vue.js"></script>
  <style>
    .active {
      font-size: 30px;
      color: red;
    }
  </style>
</head>
<body>
  <div id="root">
    <ul>
      <li 
        v-for="(li, i) in list" 
        :class="{active: i === currentIndex}"
        @click="handleClick(i)"
      >
        {{li}}
      </li>
    </ul>
  </div>
  <script type="module">
    Vue.config.productionTip = false

    var vm = new Vue({
      el: '#root',
      data: {
        list: [
          'item1',
          'item2',
          'item3'
        ],
        currentIndex: 0
      },
      methods: {
        handleClick(i) {
          this.currentIndex = i
        }
      },
    })
  </script>
</body>
</html>